﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Entities;
namespace DAL
{
    public class ChiTietGioHangDAL
    {
        #region Thuoc Tinh
        public int SoLuong { get; set; }
        private int _idSanPham;

        public int IdSanPham
        {
            get { return _idSanPham; }
            set { _sanPham = null; _idSanPham = value; }
        }
        private SanPham _sanPham = null;
        public SanPham SPham
        {
            get { if (_sanPham == null)_sanPham = new SanPham(_idSanPham); return _sanPham; }
        }
        public string Ten { get { return SPham.TenSP; } }
        public decimal Gia { get { return SPham.Gia; } }
        public decimal TongGiaTien { get { return Gia * SoLuong; } }
        #endregion
        public ChiTietGioHangDAL(int _idSanPham)
        { this.IdSanPham = _idSanPham; }
        public bool SoSanh(ChiTietGioHangDAL _chiTiet)
        {
            return this.IdSanPham == _chiTiet.IdSanPham;
        }
    }
}
